{% comment %}
SPDX-License-Identifier: CC-BY-SA-4.0
SPDX-FileCopyrightText: 2020 seL4 Project a Series of LF Projects, LLC.
{% endcomment %}
<div class="sidebar-toc hidden-xs hidden-sm col-md-3 col-lg-3">
  {% assign project = include.project %}
    <ul class="section-nav">
    	<h2> {{project.display_name}} </h2> 
        <li>
          {% capture project_page %}/projects/{{ project.name }}/{% endcapture %}
          <a style="{% if project_page == page.url %} font-weight: bold; {%endif%}" class="" href="{{ project_page }}">
            Documentation homepage
          </a>
        </li>
{% for status in site.status %}
{% if status.project == project.name %}
        <li>
          {% capture status_page %}/projects/{{ project.name }}/status.html{% endcapture %}
          <a style="{% if status_page == page.url %} font-weight: bold; {%endif%}" class="" href="{{ status_page }}">
            Status
          </a>
        </li>
{% endif %}
{% endfor %}

{% for link in project.useful_urls %}
    {% if forloop.first == true %}
        <h3>Useful URLs</h3>
    {% endif %}
        <li>
          <a style="{% if link.url == page.url %} font-weight: bold; {%endif%}" class="" href="{{ link.url }}">
            {{ link.label }}
          </a>
        </li>
{% endfor %}



{% for repo in project.repositories %}
    {% if forloop.first == true %}
        <h3>Repositories</h3>
    {% endif %}
        <li>
          <a class="" href="https://github.com/{{ repo.org }}/{{ repo.repo }}">
            {{ repo.repo }}
          </a>
        </li>
{% endfor %}

{% assign release_where_exp = "item.url contains '/releases/" | append: project.name | append: "/'" %}
{% assign releases = site['releases'] | where_exp:"item", release_where_exp %}
{% comment %}
Sort sorts by string sorting so a version of 2.3.0 is higher than 10.0.0.
Because of this we need to split the list into two before sorting.
{% endcomment %}
{% assign releases_1 = releases | where_exp:"item", "item.version_digits != 2" | sort: "version"  %}
{% assign releases_2 = releases | where_exp:"item", "item.version_digits == 2" | sort: "version" %}
{% assign releases =  releases_1 | concat: releases_2 %}
{% if project.name != 'sel4' %}
  {% for release in releases %}
      {% if forloop.first == true %}
          <h3>Releases</h3>
      {% endif %}
          <li>
            <a style="{% if release.url == page.url %} font-weight: bold; {%endif%}" href="{{ release.url }}">
              {{ release.title }}
            </a>
          </li>
  {% endfor %}
{% else %}
<h3>Releases</h3>
<h4> Master (verified kernel) </h4>

{% for release in releases  %}
    {% if release.variant != "mcs" %}
      <li>
        <a style="{% if release.url == page.url %} font-weight: bold; {%endif%}" href="{{ release.url }}">
          {{ release.title }}
        </a> (<a style="{% if release.url == page.url %} font-weight: bold; {%endif%}" href="http://sel4.systems/Info/Docs/seL4-manual-{{ release.version }}.pdf">manual</a>)
      </li>

    {% endif %}

{% endfor %}

<h4>Experimental Branches</h4>

We occasionally pre-release experimental branches for community feedback and availability.
<h5>Mixed Criticality Support (MCS) / Realtime </h5>
{% for release in releases  %}
    {% if release.variant == "mcs" %}
      <li>
        <a style="{% if release.url == page.url %} font-weight: bold; {%endif%}" href="{{ release.url }}">
          {{ release.title }}
        </a> (<a style="{% if release.url == page.url %} font-weight: bold; {%endif%}" href="http://sel4.systems/Info/Docs/seL4-manual-{{ release.version }}.pdf">manual</a>)
      </li>
    {% endif %}

{% endfor %}

{% endif %}

{% assign update_where_exp = "item.url contains '/updates/" | append: project.name | append: "/'" %}
{% assign updates = site['updates'] | where_exp:"item", update_where_exp %}
{% for update in updates | sort: "date" %}
    {% if forloop.first == true %}
        <h3>Recent Updates</h3>
    {% endif %}
        <li>
          <a style="{% if update.url == page.url %} font-weight: bold; {%endif%}" href="{{ update.url }}">
            {{ update.title }}
          </a>
        </li>
{% endfor %}
    </ul>

</div>
